#ifndef IMAGE_FEATURE_H_
#define IMAGE_FEATURE_H_

#include "ZMLAlgorithm.h"
#include <opencv2/opencv.hpp>

GLOBAL_NAMESPACE_BEGIN
namespace ImageSpace{
    class Image;
}
NAMESPACE_MACHINE_LEARNING_BEGIN


class ImageFeature
{
public:
    ImageFeature(ImageSpace::Image* ima);
    ImageFeature(const std::string& fullPath);

    void setImage(ImageSpace::Image* ima, bool bGenerateName = true);
    void setFeatureVector(const std::vector<double>& feature);
    void setLabelVector(const std::vector<int>& label); // some vector like (0, 1, 0, 0, 1, 0)

    ImageSpace::Image*  getImage();
    std::vector<double> getFeatureVector();
    std::vector<int>    getLabelVector();
    int                 getFeatureDim();

    bool loadFeatureFromFile(const char* fileName);
    bool saveFeatureToFile(const char* fileName);

    void addFeatureImage(const cv::Mat& featureImg);
    cv::Mat getFeatureImage(int idx);

    std::string getFullPath();
    void setFullPath(const std::string& path);
    std::string getName();
    void setName(const std::string& name);

private:
    ImageSpace::Image*  ima_;
    std::vector<double> feature_;
    std::vector<int>    label_;
    std::string         name_;
    std::string         saveFileFullPath_;

    std::vector<cv::Mat> featureImages_;    // for testing algorithm
};

NAMESPACE_MACHINE_LEARNING_END
GLOBAL_NAMESPACE_END

#endif//IMAGE_FEATURE_H_